<html>
<head><meta charset="utf-8"><title>nested quantification error · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html">nested quantification error</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="165921212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165921212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165921212">(May 17 2019 at 17:49)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ok, I'm going to look a bit at that error, sorry for the delay.</p>



<a name="165921429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165921429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165921429">(May 17 2019 at 17:51)</a>:</h4>
<p>You mentioned this test:</p>
<div class="codehilite"><pre><span></span><span class="c1">// compile-fail</span>

<span class="cp">#![feature(associated_type_bounds)]</span><span class="w"></span>

<span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">fmt</span>::<span class="n">Debug</span><span class="p">;</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Lam</span><span class="o">&lt;</span><span class="n">Binder</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="k">type</span> <span class="nc">App</span><span class="p">;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">nested_bounds</span><span class="o">&lt;</span><span class="n">_0</span><span class="p">,</span><span class="w"> </span><span class="n">_1</span><span class="p">,</span><span class="w"> </span><span class="n">_2</span><span class="p">,</span><span class="w"> </span><span class="n">D</span><span class="o">&gt;</span><span class="p">()</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">D</span>: <span class="nb">Clone</span> <span class="o">+</span><span class="w"> </span><span class="nb">Iterator</span><span class="o">&lt;</span><span class="n">Item</span>: <span class="nb">Send</span> <span class="o">+</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">Iterator</span><span class="o">&lt;</span><span class="n">Item</span>: <span class="nc">for</span><span class="o">&lt;</span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Lam</span><span class="o">&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;b</span><span class="w"> </span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="n">App</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">_0</span><span class="o">&gt;&gt;&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="c1">//~^ ERROR nested quantification of lifetimes [E0316]</span>
<span class="w">    </span><span class="n">_0</span>: <span class="nc">Debug</span><span class="p">,</span><span class="w"></span>
<span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">nested_bounds_desugared</span><span class="o">&lt;</span><span class="n">_0</span><span class="p">,</span><span class="w"> </span><span class="n">_1</span><span class="p">,</span><span class="w"> </span><span class="n">_2</span><span class="p">,</span><span class="w"> </span><span class="n">D</span><span class="o">&gt;</span><span class="p">()</span><span class="w"></span>
<span class="k">where</span><span class="w"></span>
<span class="w">    </span><span class="n">D</span>: <span class="nb">Clone</span> <span class="o">+</span><span class="w"> </span><span class="nb">Iterator</span><span class="o">&lt;</span><span class="n">Item</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">_2</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">_2</span>: <span class="nb">Send</span> <span class="o">+</span><span class="w"> </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">Iterator</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="k">for</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">_2</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nb">Iterator</span><span class="o">&gt;</span>::<span class="n">Item</span>: <span class="nc">for</span><span class="o">&lt;</span><span class="na">&#39;b</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Lam</span><span class="o">&lt;&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="o">&amp;</span><span class="na">&#39;b</span><span class="w"> </span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="n">App</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">_0</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="c1">//~^ ERROR nested quantification of lifetimes [E0316]</span>
<span class="w">    </span><span class="n">_0</span>: <span class="nc">Debug</span><span class="p">,</span><span class="w"></span>
<span class="p">{}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</pre></div>



<a name="165922292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165922292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165922292">(May 17 2019 at 18:01)</a>:</h4>
<p>But I'm not entirely sure that is the correct desugaring.</p>



<a name="165922383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165922383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165922383">(May 17 2019 at 18:02)</a>:</h4>
<p>Well, I guess that one could write something like:</p>
<div class="codehilite"><pre><span></span>D: for&lt;&#39;a&gt; Foo&lt;&#39;a, Bar: for&lt;&#39;b&gt; Baz&lt;&#39;b&gt;&gt;
</pre></div>


<p>which ought to desugar to</p>
<div class="codehilite"><pre><span></span>for&lt;&#39;a, &#39;b&gt; &lt;X as Foo&lt;&#39;a&gt;&gt;::Bar: Baz&lt;&#39;b&gt;
</pre></div>



<a name="165922398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165922398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165922398">(May 17 2019 at 18:02)</a>:</h4>
<p>the "nested quantification error" comes about really because our grammar is... overly flexible, in some sense</p>



<a name="165922473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165922473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165922473">(May 17 2019 at 18:03)</a>:</h4>
<p>we permit <code>for&lt;'a&gt; T: Trait&lt;'a&gt;</code> or <code>T: for&lt;'a&gt; Trait&lt;'a&gt;</code> but they are equivalent</p>



<a name="165922864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165922864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165922864">(May 17 2019 at 18:08)</a>:</h4>
<p><em>anyway</em> so I guess that means we have a few questions:</p>
<ul>
<li>Do we want that case to error, or desugar properly?</li>
<li>If error, in what phase? I sort of agree that ideally this quantification stuff would be desugared before region resolution, but that could be hard. This code is a bit grody.</li>
</ul>



<a name="165922891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165922891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165922891">(May 17 2019 at 18:08)</a>:</h4>
<p>But my other question is sort of -- what is this desugaring to <em>now</em>. It reminds me that I was going to try to double-check the binding logic in that PR.</p>



<a name="165923235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165923235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165923235">(May 17 2019 at 18:13)</a>:</h4>
<p>No worries. I appreciate you've been busy.</p>



<a name="165923254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165923254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165923254">(May 17 2019 at 18:13)</a>:</h4>
<p>hmm</p>



<a name="165923364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165923364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165923364">(May 17 2019 at 18:14)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> The desugaring now is basically what you see in <code>nested_bounds_desugared</code>, except  it's at predicate-level, not HIR level...</p>



<a name="165923380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165923380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165923380">(May 17 2019 at 18:14)</a>:</h4>
<p><span class="user-mention" data-user-id="126931">@centril</span> and I tended to think it was a reasonable desugaring</p>



<a name="165923443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165923443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165923443">(May 17 2019 at 18:15)</a>:</h4>
<p>and that it would bee fine to error on both of the above cases for now (in a similar way), until nested lifetime bounds are supported (with Chalk?), in which case the errors can disappear in both cases.</p>



<a name="165924524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924524">(May 17 2019 at 18:27)</a>:</h4>
<p>I think though that the existing solver should be able to handle nested quantifications of this kind, too</p>



<a name="165924554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924554">(May 17 2019 at 18:27)</a>:</h4>
<p>still, maybe we can move these errors to HIR lowering or astconv or something</p>



<a name="165924571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924571">(May 17 2019 at 18:27)</a>:</h4>
<p>and then just have the resolve-lifetimes code .. ignore the situation</p>



<a name="165924633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924633">(May 17 2019 at 18:28)</a>:</h4>
<blockquote>
<p>still, maybe we can move these errors to HIR lowering or astconv or something</p>
</blockquote>
<p>not astconv, ideally hir lowering</p>



<a name="165924639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924639">(May 17 2019 at 18:28)</a>:</h4>
<p>I would think</p>



<a name="165924664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924664">(May 17 2019 at 18:28)</a>:</h4>
<p>hmm</p>



<a name="165924707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924707">(May 17 2019 at 18:28)</a>:</h4>
<p>the issue is, in HIR, the sugared form is still reprsented very differently</p>



<a name="165924730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165924730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165924730">(May 17 2019 at 18:29)</a>:</h4>
<p>but maybe that's not a problem</p>



<a name="165925067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165925067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165925067">(May 17 2019 at 18:33)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> The desugaring now is basically what you see in <code>nested_bounds_desugared</code>, except  it's at predicate-level, not HIR level...</p>
</blockquote>
<p>I'm not really sure what you mean by "at predicate level", tbh -- well, I guess this desugaring is happening during astconv?</p>



<a name="165925379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165925379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165925379">(May 17 2019 at 18:36)</a>:</h4>
<p>yes, astconv... I mean, it's generating extra predicates for the desugaring, rather than modifying HIR.</p>



<a name="165925386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/165925386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#165925386">(May 17 2019 at 18:36)</a>:</h4>
<p>sorry, I didn't say that very well.</p>



<a name="166131228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/166131228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#166131228">(May 21 2019 at 00:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> left you a note about nested lifetime bounds on Github... not sure of the original motivation for banning nested quantification.</p>



<a name="166131230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/166131230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#166131230">(May 21 2019 at 00:16)</a>:</h4>
<p>I guess you're away this week though, so I'll wait for aan answer on that.</p>



<a name="166731546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/166731546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#166731546">(May 28 2019 at 16:04)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="116009">@nikomatsakis</span>. Now that you’re back can we try to get ATB wrapped up ASAP? :-) Mainly this issue.</p>



<a name="167032239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032239">(May 31 2019 at 20:36)</a>:</h4>
<p>Yep, sorry. So here's the thing -- as I wrote earlier, the "nested quantification error" is basically because Rust has this syntactic quirk</p>



<a name="167032247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032247">(May 31 2019 at 20:36)</a>:</h4>
<p>where we let you write the <code>for&lt;'a&gt;</code> binder in two (largely equivalent) places</p>



<a name="167032253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032253">(May 31 2019 at 20:36)</a>:</h4>
<p>and we didn't want people to write it in both</p>



<a name="167032258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032258">(May 31 2019 at 20:36)</a>:</h4>
<p>just because it's...misleading</p>



<a name="167032267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032267">(May 31 2019 at 20:36)</a>:</h4>
<p>i.e., you can have <code>for&lt;'a&gt; T: Foo&lt;'a&gt;</code> or <code>T: for&lt;'a&gt; Foo&lt;'a&gt;</code></p>



<a name="167032274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032274">(May 31 2019 at 20:37)</a>:</h4>
<p>we didn't want people to write <code>for&lt;'a&gt; T: for&lt;'b&gt; Foo&lt;'a, 'b&gt;</code></p>



<a name="167032294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032294">(May 31 2019 at 20:37)</a>:</h4>
<p>but not because it'd be invalid to do so <em>per se</em> -- presumably that'd be just equivalent to <code>for&lt;'a, 'b&gt; T: Foo&lt;'a, 'b&gt;</code></p>



<a name="167032310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167032310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167032310">(May 31 2019 at 20:37)</a>:</h4>
<p>it's not really obvious to me that this error has much or anything to do with this case</p>



<a name="167034671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167034671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167034671">(May 31 2019 at 21:09)</a>:</h4>
<p>Oh I see</p>



<a name="167034685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167034685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167034685">(May 31 2019 at 21:10)</a>:</h4>
<p>So we may not need any modification in this case eh.</p>



<a name="167034782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/nested%20quantification%20error/near/167034782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/nested.20quantification.20error.html#167034782">(May 31 2019 at 21:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> In that case I’ll let you address those two WIP commits if you would, then LGTM. :-)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>